home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / octa209s.zip / octave-2.09 / src / defun-int.h < prev    next >
C/C++ Source or Header  |  1997-05-28  |  3KB  |  94 lines

  1. /*
  2.  
  3. Copyright (C) 1996 John W. Eaton
  4.  
  5. This file is part of Octave.
  6.  
  7. Octave is free software; you can redistribute it and/or modify it
  8. under the terms of the GNU General Public License as published by the
  9. Free Software Foundation; either version 2, or (at your option) any
  10. later version.
  11.  
  12. Octave is distributed in the hope that it will be useful, but WITHOUT
  13. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15. for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with Octave; see the file COPYING.  If not, write to the Free
  19. Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  20.  
  21. */
  22.  
  23. #if !defined (octave_defun_int_h)
  24. #define octave_defun_int_h 1
  25.  
  26. #include "variables.h"
  27.  
  28. // MAKE_BUILTINS is defined to extract function names and related
  29. // information and create the *.def files that are eventually used to
  30. // create the buitlins.cc file.
  31.  
  32. #ifdef MAKE_BUILTINS
  33.  
  34. // Generate code to install name in the symbol table.  The script
  35. // mkdefs will create a .def file for every .cc file that uses DEFUN,
  36. // DEFUN_TEXT, or DEFUN_DLD.
  37.  
  38. #define DEFUN_INTERNAL(name, args_name, nargout_name, is_text_fcn, doc) \
  39.   BEGIN_INSTALL_BUILTIN \
  40.     extern DECLARE_FUN (name, args_name, nargout_name); \
  41.     DEFINE_FUN_STRUCT (name, is_text_fcn, doc); \
  42.     install_builtin_function (S ## name); \
  43.   END_INSTALL_BUILTIN
  44.  
  45. // Generate code for making another name for an existing function.
  46.  
  47. #define DEFALIAS_INTERNAL(alias, name) \
  48.   BEGIN_INSTALL_BUILTIN \
  49.   alias_builtin (#alias, #name); \
  50.   END_INSTALL_BUILTIN
  51.  
  52. #else /* ! MAKE_BUILTINS */
  53.  
  54. // Generate the first line of the function definition.  This ensures
  55. // that the internal functions all have the same signature.
  56.  
  57. #define DEFUN_INTERNAL(name, args_name, nargout_name, is_text_fcn, doc) \
  58.   DECLARE_FUN (name, args_name, nargout_name)
  59.  
  60. // No definition is required for an alias.
  61.  
  62. #define DEFALIAS_INTERNAL(name, alias)
  63.  
  64. #endif /* ! MAKE_BUILTINS */
  65.  
  66. // Define the structure that will be used to insert this function into
  67. // the symbol table.
  68.  
  69. #define DEFINE_FUN_STRUCT(name, is_text_fcn, doc) \
  70.   static builtin_function S ## name (#name, is_text_fcn, F ## name, doc)
  71.  
  72. #define DEFINE_FUN_STRUCT_FUN(name, is_text_fcn, doc) \
  73.   builtin_function& \
  74.   FS ## name (void) \
  75.   { \
  76.     static builtin_function *retval = 0; \
  77.  \
  78.     if (! retval) \
  79.       retval = new builtin_function (#name, is_text_fcn, F ## name, doc); \
  80.  \
  81.     return *retval; \
  82.   }
  83.  
  84. #define DECLARE_FUN(name, args_name, nargout_name) \
  85.   octave_value_list F ## name (const octave_value_list& args_name, int nargout_name)
  86.  
  87. #endif
  88.  
  89. /*
  90. ;;; Local Variables: ***
  91. ;;; mode: C++ ***
  92. ;;; End: ***
  93. */
  94.